package edu.terapia.model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the identity_object database table.
 * 
 */
@Entity
@Table(name="identity_object")
public class IdentityObject implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int id;

	private String name;

	//bi-directional many-to-one association to IdentityObjectType
	@ManyToOne
	@JoinColumn(name="IDENTITY_OBJECT_TYPE_ID")
	private IdentityObjectType identityObjectType;

	//bi-directional many-to-one association to IdentityObjectAttribute
	@OneToMany(mappedBy="identityObject")
	private List<IdentityObjectAttribute> identityObjectAttributes;

	//bi-directional many-to-one association to IdentityObjectCredential
	@OneToMany(mappedBy="identityObject")
	private List<IdentityObjectCredential> identityObjectCredentials;

	//bi-directional many-to-one association to IdentityPermission
	@OneToMany(mappedBy="identityObject")
	private List<IdentityPermission> identityPermissions;

	public IdentityObject() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public IdentityObjectType getIdentityObjectType() {
		return this.identityObjectType;
	}

	public void setIdentityObjectType(IdentityObjectType identityObjectType) {
		this.identityObjectType = identityObjectType;
	}

	public List<IdentityObjectAttribute> getIdentityObjectAttributes() {
		return this.identityObjectAttributes;
	}

	public void setIdentityObjectAttributes(List<IdentityObjectAttribute> identityObjectAttributes) {
		this.identityObjectAttributes = identityObjectAttributes;
	}

	public IdentityObjectAttribute addIdentityObjectAttribute(IdentityObjectAttribute identityObjectAttribute) {
		getIdentityObjectAttributes().add(identityObjectAttribute);
		identityObjectAttribute.setIdentityObject(this);

		return identityObjectAttribute;
	}

	public IdentityObjectAttribute removeIdentityObjectAttribute(IdentityObjectAttribute identityObjectAttribute) {
		getIdentityObjectAttributes().remove(identityObjectAttribute);
		identityObjectAttribute.setIdentityObject(null);

		return identityObjectAttribute;
	}

	public List<IdentityObjectCredential> getIdentityObjectCredentials() {
		return this.identityObjectCredentials;
	}

	public void setIdentityObjectCredentials(List<IdentityObjectCredential> identityObjectCredentials) {
		this.identityObjectCredentials = identityObjectCredentials;
	}

	public IdentityObjectCredential addIdentityObjectCredential(IdentityObjectCredential identityObjectCredential) {
		getIdentityObjectCredentials().add(identityObjectCredential);
		identityObjectCredential.setIdentityObject(this);

		return identityObjectCredential;
	}

	public IdentityObjectCredential removeIdentityObjectCredential(IdentityObjectCredential identityObjectCredential) {
		getIdentityObjectCredentials().remove(identityObjectCredential);
		identityObjectCredential.setIdentityObject(null);

		return identityObjectCredential;
	}

	public List<IdentityPermission> getIdentityPermissions() {
		return this.identityPermissions;
	}

	public void setIdentityPermissions(List<IdentityPermission> identityPermissions) {
		this.identityPermissions = identityPermissions;
	}

	public IdentityPermission addIdentityPermission(IdentityPermission identityPermission) {
		getIdentityPermissions().add(identityPermission);
		identityPermission.setIdentityObject(this);

		return identityPermission;
	}

	public IdentityPermission removeIdentityPermission(IdentityPermission identityPermission) {
		getIdentityPermissions().remove(identityPermission);
		identityPermission.setIdentityObject(null);

		return identityPermission;
	}

}